var express = require('express');
var router = express.Router();
const User = require('../database/redis/userDao');

/* GET home page. */
router.get('/', async function (req, res, next) {

  if (req.session.userId != null) {
    let userData = await User.asyncGetDataById(req.session.userId);
    //如果找不到会返回null
    if (userData != null) {
        //用户信息写入模板引擎
      res.locals.userData = userData;
    }
  }
  res.render('header');
});

module.exports = router;
